# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : zsj.py
# @Time     : 2024/4/14 19:39
# @Author   : Robot-Zsj
"""
description:

i:
0,1,4,3,1,0,0,1,2,3,1,1,2,1,0

o:
3
"""

heights = list(map(int, input().split(",")))


def getResult():
    count = 0

    for i in range(len(heights)):

        leftH = heights[i - 1] if i - 1 >= 0 else 0
        rightH = heights[i + 1] if i + 1 < len(heights) else 0

        if heights[i] > leftH and heights[i] > rightH:
            count += 1

    return count


print(getResult())
